package mx.netbrain.dao.impl;

import org.apache.log4j.Logger;
import org.hibernate.Session;

import mx.netbrain.dao.TreeUserDao;
import mx.netbrain.model.TreeUser;
import mx.netbrain.util.HibernateUtil;

public class TreeUserDaoImpl implements TreeUserDao {

	private static final Logger logger = Logger
			.getLogger(TreeUserDaoImpl.class);
	
	@Override
	public void save(TreeUser treeuser) {
		Session session = HibernateUtil.getSessionFactory().openSession();
		try {
			session.beginTransaction();
			session.persist(treeuser);
			session.beginTransaction().commit();
		} catch (Exception e) {
			logger.error("Save: " + e.getMessage());
			session.beginTransaction().rollback();
		}

	}
}
